<%@ include file="/WEB-INF/views/taglibs.jsp"%>
<html>
<head>
	<script type="text/javascript">
	function setPerson(personToBeRemoved) {
		document.getElementById("unassignPersonInProject").value = personToBeRemoved;
		document.getElementById("unassignedPersonForm").submit();
	}	
	</script>
</head>
<body>
<h3 align="right">
		<a class="logout"
			href="<spring:url value='/j_spring_security_logout' htmlEscape='true' />">Logout</a>
	</h3>
	<h1>THE PROJECTOR </h1></th>
		<h3>Project Assignments - Smart Form </h3>
	<form:form name="assignPersonForm" action="assignPerson" >
		<table>
			
			<tr>
				<td>
					<select name="personThatIsNotAssigned" id="personThatIsNotAssigned">
						<c:forEach var="personNotAssigned" items="${personsNotAssigned}">
							<option value="${personNotAssigned.id}"> ${personNotAssigned.firstName} </option>
						</c:forEach>
					</select>
				</td>
				<td> <input type=submit value="Add" /> </td>
				</tr>
				
		</table>
	<input type="hidden" name="projectId" id="projectId" value="${projectId}" />
		
	</form:form>
	<form:form name="unassignedPersonForm" id="unassignedPersonForm" action="unassignPerson">
		<table>
		
			<c:forEach var="personAssigned" items="${personsAssigned}">
			<tr>
					
				<td> ${personAssigned.firstName} </td><td><a href="#"	id="${personAssigned.id}" onClick="setPerson(this.id)">Removed</a></td>
			</tr>
			</c:forEach>
		</table>
		<input type="hidden" name="unassignPersonInProject" id="unassignPersonInProject" />
		<input type="hidden" name="projectId" id="projectId" value="${projectId}" /> 
	</form:form>

</body>


</html>